import { post } from '@/http/request';

// type
export type LoginRequest = {
    username: string;
    password: string | number;
};

export type LoginResponse = {
    username: string;
    roles: Array<string>; //  string[]
    accessToken: string;
};

export type reLoginRequest = {
    accessToken: string;
};

// function
export const userLogin = async (data?: LoginRequest) => {
    return post<LoginResponse>({}, '/login', data);
};

export const refreshUserInfo = async (data?: reLoginRequest) => {
    return post<LoginResponse>({}, '/getUserInfo', data);
};
